import React, { Component, useEffect } from 'react';
import { AppRegistry, Text, View } from 'react-native';
import Nav from './src/nav';
import Toast, { BaseToast, ErrorToast } from 'react-native-toast-message';
import { toastConfig } from './src/utils/toastConfig';
import { MyContext, rootStore } from './src/store';
import { observer,inject, } from 'mobx-react-lite';
// import { observer, inject } from 'mobx-react';
import  Loading from './src/components/custmerToast';
import Geo from './src/views/Detail/index';
 

// @observer
// class App extends Component {
//   async componentDidMount() {
    
   
    
//   }
//   render() {
//     return (
//       <MyContext.Provider value={rootStore}>
//         <View style={{ flex: 1 }}>
//           <Nav />
//           <Toast config={toastConfig} />
//           <Loading />
//         </View>
//       </MyContext.Provider> 
      
//     );
//   }
// }
// export default App;
function App() {
  const init = async () => {
    await Geo.initGeo();
    setTimeout(()=> {
      Geo.getCityByLocation();
    }, 2000)
  }
  useEffect(() => {
    init();
  })
  return (
    <MyContext.Provider value={rootStore}>
      <View style={{ flex: 1 }}>
        <Nav />
        <Toast config={toastConfig} />
        <Loading />
      </View>
    </MyContext.Provider> 
  );
}
export default observer(App);